{$subtot = 0}
<table align="center" width="50%">
<tr>
    <th colspan="9">Productos en pedidos</th>
</tr>
<tr>
    <th>Pieza</th>
    <th>Existencia</th>
{for $count = 0 to 5}
    <th><a href="http://servidor1:82/maquinado/index/ped2/{$smarty.now|date_format:"%W"+($count+1)}">{$smarty.now|date_format:"%W"+($count+1)}</a></th>
{/for}
<th>Total</th>
</tr>
{foreach item='cons' from=$Paroen }
<tr>
    <td> {$cons.parte}</td>
    <td> {$cons.exist}</td>
    {for $count = {$smarty.now|date_format:"%W"}+1 to {$smarty.now|date_format:"%W"} + 6}
        {if isset($cons[$count])}
            <td title="{$count}" id="{$cons.parte}_{$count}" onclick="verdiv(this.id)" ondblclick="escdiv(this.id)">
            
                {$cons[$count].totsaldo}
                
                <div style="display: block;position: absolute;float: left;opacity:0;background-color: aliceblue;" id="{$cons.parte}_{$count}_sdiv">
                    <strong style="text-align:center;">{$cons.parte} {$count}</strong><hr />
                    <form method="POST" id="{$cons.parte}_{$count}_form">
                    {for $i=0 to 2}
                    
                        <select>
                            <option></option>
                        {foreach item='maquina' from=$listmaq[$cons.parte]}
                            <option>{$maquina.Maquina}</option>
                        {/foreach}
                        </select>
                        <input type="number" max="{$cons[$count].totsaldo}" min="0"/>
                        <input type="number" min="1" max="53" value="{$count}"/><br />
                    {/for}
                        <input type="submit" value="ajustar"/>
                    </form>
                </div>
            </td>
            {$subtot = $subtot + $cons[$count].totsaldo}
            {*$max = "max='"|cat:$cons[$count].totsaldo|cat:"'"*}
        {else}
            <td title="{$count}" >&nbsp;</td>
            {*$max = ""*}
        {/if}
    {/for}
    {if $subtot == 0}
    <td><strong>&nbsp;</strong></td>
    {else}
    <td style="text-align:center;"><strong>{$subtot}</strong></td>
    {/if}
    
    {$subtot = 0}
</tr>
{/foreach}
</table>
<script>
    function verdiv(id){
        var cad = id + '_sdiv';
        document.getElementById(cad).style.opacity = "1";
        document.getElementById(cad).style.zindex = "1000";
        document.getElementById(id).style.color = "Red";
    }
    function escdiv(id){
        var cad = id + '_sdiv';
        document.getElementById(cad).style.opacity = "0";
        document.getElementById(cad).style.zindex = "1";
        document.getElementById(id).style.color = "Black";
    }
</script>